﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using Frogism.Core.Drinking;
using Frogism.Core;

namespace Frogism.Data._2
{
   public  class DrinkRepository : Core.Drinking.IDrinkRepository
    {
       
        public IList<DrinkDay> DrinksForDay(DateTime day)
        {
            using (ISession session = NHConfig.GetSessionFactory().OpenSession())
            {
                return session.CreateQuery("from DrinkDay o where o.Day = :Day").SetParameter<DateTime>("Day", day).List<DrinkDay>(); 
            }
        }

        public IEnumerable<Frogism.Core.Drinking.DrinkItem> DrinksForPeriod(DateTime start, DateTime end)
        {
            throw new NotImplementedException();
        }

        public void SaveDrinkItem(Frogism.Core.Drinking.DrinkItem item)
        {
            throw new NotImplementedException();
        }

        public void UpdateDrinkItem(Frogism.Core.Drinking.DrinkItem item)
        {
            throw new NotImplementedException();
        }


        public IEnumerable<DrinkType> DrinkTypeList()
        {
            using (ISession session = NHConfig.GetSessionFactory().OpenSession())
            {
                return session.CreateQuery("from DrinkType").List<Core.Drinking.DrinkType>();
            }
        }

    }
}
